﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MINERP.Statistics.IView;
using MINERP.BLL.Statistics;
using MINERP.MODEL.FoundationModel;
using System.Windows.Forms;

namespace MINERP.Statistics.Presenter
{
    public  class PBillEdit
    {
        private IFrmBillEdit _IView;
        private BillEditBLL _bll;
        public PBillEdit(IFrmBillEdit iview)
        {
            _IView = iview;
            _bll = new BillEditBLL();
 
        }
        public void Init()
        {
            _IView.StartTime = Convert.ToDateTime("2000-02-02");
            _IView.EndTime = DateTime.Now;
            _IView.ShopBanDing(_bll.GetShopList());
        }

        public void DisPlayBill()
        {
            List<BillView> billView = _bll.GetBillByShop(_IView.ShopId, _IView.StartTime, _IView.EndTime);
            _IView.DispalyShopBill(billView);
        }
        public List<BillDetailView> GetDetails(int inBillId)
        {
            return _bll.GetBillDetailList(inBillId);
        }
        public List<Bill_Detail_Detail_Info> GetDetailDetail(int indetailId)
        {
            return _bll.GetBilldetaildetail(indetailId);
        }
        public void DisPlayBill(int inId)
        {
            List<BillView> billView = _bll.GetBillByShop(inId);
            _IView.DispalyShopBill(billView);
        }
        public OrderInfo_Info GetProduct(string incode)
        {
            OrderInfo_Info order = _bll.GetProductByCode(incode);
            if (order == null)
            {
               // MessageBox.Show("产品不存在，或者该产品未生产完成", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return null;
            }
            else
            {
                return order;
            }
        }
    }
}
